﻿<Window x:Class="GlobalizationTools.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ui="clr-namespace:GlobalizationTools.UI"
        xmlns:vm="clr-namespace:GlobalizationTools.ViewModel"
        Title="Globalization Tools"
        Height="500"
        Width="750"
        Background="{DynamicResource GradientBackgroundBrush}"
        ui:CreateCommandContext.Context="{Binding}"
        Icon="/GlobalizationTools;component/ViewModel/Images/Resource.png"
        Closing="Window_Closing"
        ResizeMode="CanResizeWithGrip"
        Loaded="Window_Loaded">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ViewModel\Templates.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Window.DataContext>
        <vm:TreeViewRootViewModel x:Name="RootModel" />
    </Window.DataContext>
    <Grid DataContext="{Binding}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Menu VerticalAlignment="Top"
              Background="Transparent">
            <MenuItem Header="{LocText GlobalizationTools:LocalizationResource:File}">
                <ui:MenuButton Command="vm:TreeViewRootViewModel.OpenCommand" />
                <ui:MenuButton Command="vm:TreeViewItemViewModel.CloseCommand" />
                <Separator />
                <ui:MenuButton Command="vm:TreeViewRootViewModel.SaveCommand" />
                <ui:MenuButton Command="vm:TreeViewRootViewModel.SaveAllCommand" />
                <Separator />
                <MenuItem Command="ApplicationCommands.Close" />
            </MenuItem>
            <MenuItem Header="?">
                <MenuItem Header="{LocText GlobalizationTools:LocalizationResource:About}"
                          Click="MenuItem_Click" />
            </MenuItem>
        </Menu>
        <ToolBar Grid.Row="1">
            <ui:ToolBarButton Command="vm:TreeViewRootViewModel.OpenCommand" />
            <ui:ToolBarButton Command="vm:TreeViewItemViewModel.CloseCommand" />
            <Separator />
            <ui:ToolBarButton Command="vm:TreeViewResourceViewModel.OpenCommand" />
            <ui:ToolBarButton Command="vm:TreeViewRootViewModel.SaveCommand" />
            <ui:ToolBarButton Command="vm:TreeViewRootViewModel.SaveAllCommand" />
        </ToolBar>
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200"
                                  MinWidth="60" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*"
                                  MinWidth="60" />
            </Grid.ColumnDefinitions>
            <TreeView ItemsSource="{Binding Children}"
                      ItemContainerStyle="{DynamicResource SolutionTreeViewItemStyle}">
            </TreeView>
            <GridSplitter Grid.Column="1"
                          Width="3"
                          VerticalAlignment="Stretch"
                          ResizeBehavior="PreviousAndNext"
                          ResizeDirection="Columns"
                          Background="Transparent" />
            <TabControl Grid.Column="2"
                        IsSynchronizedWithCurrentItem="True"
                        Background="{DynamicResource {x:Static SystemColors.AppWorkspaceBrushKey}}"
                        ItemsSource="{Binding Resources}"
                        ItemTemplate="{DynamicResource TabItemTemplate}"
                        SelectedItem="{Binding SelectedTabControlModel}"
                        BorderThickness="0" />
        </Grid>
        <StatusBar Grid.Row="3">
            <StatusBarItem Content="{Binding StatusText}" />
        </StatusBar>
    </Grid>
</Window>
